package com.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.app.R;

public class MenuAdapter extends BaseAdapter {
    private Context context;
    private String[] menuStrArray;

    public MenuAdapter(Context context, String[] menuStrArray) {
        this.context = context;
        this.menuStrArray = menuStrArray;
    }

    public MenuAdapter() {
    }

    @Override
    public int getCount() {
        return menuStrArray.length;
    }

    @Override
    public Object getItem(int position) {
        return menuStrArray[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.menu_item_layout,null);
        TextView menuTitle = convertView.findViewById(R.id.menu_lv_tv);
        menuTitle.setText(menuStrArray[position]+"");
        return convertView;
    }
}
